package com.filter.control.controller;

import com.filter.control.common.Result;
import com.filter.control.po.ContainerQuotaUpdatePO;
import com.filter.control.service.FilterServiceImpl;
import org.springframework.beans.factory.annotation.Autowired;
import org.springframework.web.bind.annotation.*;

import javax.validation.Valid;

/**
 * 教学拦截器
 * @author
 */
@RestController
@RequestMapping("tes/container")
public class ContainerFilterController {

    @Autowired
    private FilterServiceImpl tesServiceImpl;

    @GetMapping("quota")
    public Result<Integer> queryContainerQuota() {
        Integer quota = tesServiceImpl.getContainerQuota(FilterServiceImpl.TES);
        return Result.success(quota);
    }

    @PostMapping("quota")
    public Result updateContainerQuota(@RequestBody @Valid ContainerQuotaUpdatePO containerQuotaUpdatePO) {
        tesServiceImpl.saveContainerQuota(FilterServiceImpl.TES , containerQuotaUpdatePO.getContainerQuota());
        return Result.success();
    }

}
